<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Apple devices fullscreen -->
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link href="/public/css/main.css" rel="stylesheet" type="text/css">
<link href="/public/css/page.css" rel="stylesheet" type="text/css">
<link href="/public/font/css/font-awesome.min.css" rel="stylesheet" />
<link href="/public/js/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<link href="/public/js/perfect-scrollbar.min.css" rel="stylesheet" type="text/css"/>
<style type="text/css">html, body { overflow: visible;}</style>
<script type="text/javascript" src="/public/js/jquery.js"></script>
<script type="text/javascript" src="/public/js/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="/public/js/layer/layer.js"></script><!-- 弹窗js 参考文档 http://layer.layui.com/-->
<script type="text/javascript" src="/public/js/admin.js"></script>
<script type="text/javascript" src="/public/js/jquery.validation.min.js"></script>
<script type="text/javascript" src="/public/js/common.js"></script>
<script type="text/javascript" src="/public/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/public/js/jquery.mousewheel.js"></script>

 <script type="text/javascript" charset="utf-8" src="/public/editor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/editor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/public/editor/lang/zh-cn/zh-cn.js"></script>

<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer"
	 style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
	<form class="form-horizontal" id="adminHandle" action="" method="post">
		<input type="hidden" name="id" value="{$data.id}">
		<div class="ncap-form-default">
			<div id="cons">
				<dl class="row">
					<dt class="tit">
						<label for="password"><em></em>问题名称</label>
					</dt>
					<dd class="opt">
						<input type="text" name="name" id="name" value="{$data.name}" style="width:450px" >
					</dd>
				</dl>
				<dl class="row">
					<dt class="tit">
						<label for="password"><em></em>发布者</label>
					</dt>
					<dd class="opt">
						<input type="text" name="question_user" id="question_user" value="{$data.question_user}" style="width:450px">
					</dd>
				</dl>
			</div>
			  <dl class="row">
                <dt class="tit">
                    <label for="password"><em></em>问题内容</label>
                </dt>
                <dd class="opt">
                    <script name="question" id="editor" type="text/plain" style="width:960px;height:300px;">{$data.question}</script>
            
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="password"><em></em>解决者</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="answer_user" id="answer_user" value="{$data.answer_user}" style="width:450px">
                </dd>
            </dl>
             <dl class="row">
                <dt class="tit">
                    <label for="password"><em></em>解决内容</label>
                </dt>
                <dd class="opt">
                    <script name="answer" id="editor1" type="text/plain" style="width:960px;height:300px;">{$data.answer}</script>
            
                </dd>
            </dl>
            <dl class="row">
                    <dt class="tit">
                        <label for="text"><em></em>是否结束</label>
                    </dt>
                    <dd class="opt">
	                    <input type="radio" name="status"  value="1" checked >已结束
	                    <input type="radio" name="status"  value="0">未结束
                    </dd>
            </dl>
             <dl class="row">
                    <dt class="tit">
                        <label for="text"><em></em></label>
                    </dt>
                    <dd class="opt">
                        <a type="button" class="ncap-btn-big ncap-btn-orange" id="submits">保存</a>
                    </dd>
            </dl>
		</div>
	</form>
</div>
<script type="text/javascript">

	//实例化编辑器
	//建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
	var ue = UE.getEditor('editor');
	var ue1 = UE.getEditor('editor1');
	$(document).on('click', '#submits', function(){
        var answer_user = $("#answer_user").val();
        if(answer_user == ''){
            alert('解决者不能为空！');        
            return false;
        }
  
        $('form').submit();
	})

 
	function setblur(e){
		UE.getEditor('editor').blur();
		UE.dom.domUtils.preventDefault(e)
	}
	function insertHtml() {
		var value = prompt('插入html代码', '');
		UE.getEditor('editor').execCommand('insertHtml', value)
	}
	function createEditor() {
		enableBtn();
		UE.getEditor('editor');
	}
	function getAllHtml() {
		alert(UE.getEditor('editor').getAllHtml())
	}
	function getContent() {
		var arr = [];
		arr.push("使用editor.getContent()方法可以获得编辑器的内容");
		arr.push("内容为：");
		arr.push(UE.getEditor('editor').getContent());
		alert(arr.join("\n"));
	}
	function getPlainTxt() {
		var arr = [];
		arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
		arr.push("内容为：");
		arr.push(UE.getEditor('editor').getPlainTxt());
		alert(arr.join('\n'))
	}
	function setContent(data) {
		UE.getEditor('editor').setContent(data);
	}
	function setDisabled() {
		UE.getEditor('editor').setDisabled('fullscreen');
		disableBtn("enable");
	}

	function setEnabled() {
		UE.getEditor('editor').setEnabled();
		enableBtn();
	}

	function getText() {
		//当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
		var range = UE.getEditor('editor').selection.getRange();
		range.select();
		var txt = UE.getEditor('editor').selection.getText();
		alert(txt)
	}

	function getContentTxt() {
		var arr = [];
		arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
		arr.push("编辑器的纯文本内容为：");
		arr.push(UE.getEditor('editor').getContentTxt());
		alert(arr.join("\n"));
	}
	function hasContent() {
		var arr = [];
		arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
		arr.push("判断结果为：");
		arr.push(UE.getEditor('editor').hasContents());
		alert(arr.join("\n"));
	}
	function setFocus() {
		UE.getEditor('editor').focus();
	}
	function deleteEditor() {
		disableBtn();
		UE.getEditor('editor').destroy();
	}
	function disableBtn(str) {
		var div = document.getElementById('btns');
		var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
		for (var i = 0, btn; btn = btns[i++];) {
			if (btn.id == str) {
				UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
			} else {
				btn.setAttribute("disabled", "true");
			}
		}
	}
	function enableBtn() {
		var div = document.getElementById('btns');
		var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
		for (var i = 0, btn; btn = btns[i++];) {
			UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
		}
	}

	function getLocalData () {
		alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
	}

	function clearLocalData () {
		UE.getEditor('editor').execCommand( "clearlocaldata" );
		alert("已清空草稿箱")
	}

</script>
</body>
</html>